
# Please see readme.txt for notes about dependencies, packages, and scripts before running.
# NOTE: Uses code from Stargazer Package Updates.R instead of the published version of Stargazer.

# REQUIRES: Data/
# REQUIRES: Data/Roper Data.csv
# REQUIRES: Data/Roper Iraq War Opinion Data.csv
# REQUIRES: Data/Framing the Exit Experiment Raw Data.csv
# REQUIRES: Plots/

rm(list=ls())

################# Load Packages #################
source("Load Packages.R")

################# Roper Analysis #################
source("Analysis - Roper/Cleaning.R")

source("Analysis - Roper/Figure 1 - US Public Support for Withdrawal Over Time.R")
source("Analysis - Roper/Figure 2 - US Public Support for Withdrawal Over Time_VIA.R")

source("Analysis - Roper/Table 1 - Predictors of US Public Support for Withdrawal 1946-2021.R")
source("Analysis - Roper/Table S1 - Predictors of US Public Support for Withdrawal 1946-2021.R")
## With context features: war duration and log in change casualties
source("Analysis - Roper/Table S2 - Predictors of US Public Support for Withdrawal 1946-2021.R")
## With the no. response dummies
source("Analysis - Roper/Table S3 - Predictors of US Public Support for Withdrawal 1946-2021.R")
## With SEs clustered by campaign
source("Analysis - Roper/Table S4 - Predictors of U.S. Public Support for Withdrawal 1946-2021 - Vietnam and Iraq.R")
## Iraq and Vietnam
source("Analysis - Roper/Table S5 - Predictors of US Public Support for Withdrawal 1946-2021.R")
## With the % withdrawal options variable
source("Analysis - Roper/Table S6 - Predictors of US Public Support for Withdrawal 1946-2021.R")
## With controls for survey mode and house fixed effects
source("Analysis - Roper/Table S7 - Predictors of US Public Support for Withdrawal 1946-2021.R")
## With SEs clustered by poll

source("Analysis - Roper/Figure S4 - Support for Withdrawal vs. Lack of Support for War during the Iraq War.R")

rm(roper)


################# Experiment Analysis #################
source("Analysis - Experiment/Cleaning.R")

source("Analysis - Experiment/Table 2 - Effects of Framing on Attitudes Toward Withdrawal.R")

source("Analysis - Experiment/Figure 3 - Attitudes Toward Withdrawal Across Treatment Conditions.R")

source("Analysis - Experiment/Table S8 - Covariate Balance Tests.R")

# Table S9 - Different Versions of Experimental Treatment Question <- Manaully Generated

source("Analysis - Experiment/Table S10 - Effects of Framing on Attitudes Toward Withdrawal.R")
# With both treatments and the interaction

source("Analysis - Experiment/Figure S1 - Interaction of Enemy Victory Frame and Political Ideology.R")
source("Analysis - Experiment/Figure S2 - Interactions of Enemy Victory Frame with Foreign Policy Predispositions.R")
source("Analysis - Experiment/Figure S3 - Interaction of Middle Ground Frame and Identifying as a Political Moderate.R")

rm(data, data_recoded)
